package com.quan.server.beans;

import com.mark.util.JsonUtil;

import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.List;

@Entity
public class InvitingRecord {
    @Id
    public String id;
    public String customerId;
    public String inviterCustomerIdList = "[]";

    public static InvitingRecord addNewCustomerId(InvitingRecord invitingRecord, String customerId) {
        List<String> inviterCustomerIdList = JsonUtil.json2Bean(invitingRecord.inviterCustomerIdList, List.class);
        inviterCustomerIdList.add(0, customerId);
        invitingRecord.inviterCustomerIdList = JsonUtil.bean2Json(inviterCustomerIdList);
        return invitingRecord;
    }
}
